import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/system/admin/login',
    method: 'post',
    data
  })
}

export function getInfo(token,id) {
  return request({
    url: '/system/admin/getUserInfo/'+id,
    method: 'get',
    headers: {
      'X-Token': `${token}`
    }
  })
}


export function logout() {
  return request({
    url: '/system/admin/logout',
    method: 'post'
  })
}
export function addAdmin(data) {
  return request({
    url: '/system/admin/addAdmin',
    method: 'post',
    data
  })
}
export function allAdmin(data) {
  return request({
    url: '/system/admin/findAdmin',
    method: 'get',
    data
  })
}
export function getAdminInfo(id) {
  return request({
    url: `/system/admin/${id}`,
    method: 'get'
  })
}
export function deleteByid(id) {
  return request({
    url: "/system/admin/delete/id",
    method: 'post',
    params:{id}
  })
}

export function updateById(data) {
  return request({
    url: "/system/admin/updateById",
    method: 'post',
    data
  })
}
export function getCaptcha(){
  return request({
    url: "/system/admin/captcha",
    method: 'get'
  })
}